package com.example.xm.controller;

import com.example.xm.entity.PinglunEntity;
import com.example.xm.service.PinglunService;
import com.example.xm.web.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/pinglun")
public class PinglunController {
    @Autowired
    PinglunService pinglunService;
    @PostMapping("/add")
    public Result add(@RequestBody PinglunEntity pinglunEntity){
       PinglunEntity entity= pinglunService.add(pinglunEntity);
       return Result.success(entity);
    }
    @GetMapping("/list")
    public Result list(Integer productId){
     List<PinglunEntity> list= pinglunService.list(productId);
     return Result.success(list);
    }
}
